<template>
  <the-table
    ref="table"
    :columns="columns"
    uri="agency-accounts"
    :slots="['income']"
    @loaded="loaded"
  >
    <span slot="income" slot-scope="{ row }">{{
      row.boughts_sum_fee * 1 + row.boughts_sum_tip * 1
    }}</span>
  </the-table>
</template>
<script>
import moment from 'moment'
const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
    width: 60,
  },
  {
    title: '代理名',
    dataIndex: 'user.username',
    searchAble: true,
  },
  {
    title: '时间段',
    dataIndex: 'created_at',
    dataType: 'range',
    visible: false,
    searchAble: true,
    search: {
      value: [moment(), moment()],
    },
  },
  {
    title: '代理收益',
    scopedSlots: { customRender: 'income' },
    searchAble: false,
  },
  {
    title: '订单佣金',
    dataIndex: 'boughts_sum_fee',
  },
  {
    title: '奖励',
    dataIndex: 'boughts_sum_tip',
  },
  {
    title: '已领',
    dataIndex: 'b4',
  },
  {
    title: '下级人数',
    dataIndex: 'members_count',
  },
  {
    title: '买币总数',
    dataIndex: 'boughts_sum_coins',
  },
  {
    title: '买币笔数',
    dataIndex: 'boughts_count',
  },
]

import theTable from '@/components/theTable.vue'
import tableFooter from '@/mixins/table-footer.js'
export default {
  components: { theTable },
  mixins: [tableFooter],
  data() {
    return {
      columns,
    }
  },
}
</script>
